package com.alison.SmartCli.BuiltInFunction;

import java.util.HashMap;

public class BuiltInManager {

    private static HashMap<String,BuiltIn> functions = new HashMap<>();

    static{
        functions.put("usage",new UsageFunction());
        functions.put("exit", new ExitFunction());
    }

    public static boolean isBuiltInFunction(String method){
        return functions.containsKey(method.toLowerCase());
    }

    public static void invokeBuiltInFunction(String method,String[] args){
        if (!isBuiltInFunction(method)){
            return;
        }
        functions.get(method).execute(args);
    }

    static BuiltIn getFunction(String method){
        return functions.get(method);
    }

}
